<?php	
	$name = isset($_REQUEST['studentName']) ? $_REQUEST['studentName'] : '';
	$age = isset($_REQUEST['studentAge']) ? $_REQUEST['studentAge'] : '';
	$id = isset($_REQUEST['studentId']) ? $_REQUEST['studentId'] : 0;	
	$login = isset($_REQUEST['studentLogin']) ? $_REQUEST['studentLogin'] : '';
	$password = isset($_REQUEST['studentPassword']) ? $_REQUEST['studentPassword'] : '';	
	
	if (isset($_REQUEST['add']) && $name && $age && $login && $password){
		$student = new Student($name, $age, $login, $password);
		StudentTable::getInstance()->addStudent($student); 
	}	
		
	if (isset($_REQUEST['edit']) && $name && $age){
		$student = new Student($name, $age, $login, $password, $id);
		StudentTable::getInstance()->editStudent($student); 
	}	
		
	if (isset($_REQUEST['delete']) && $id){
		StudentTable::getInstance()->deleteStudent($id);				
	}

	$aStudents = StudentTable::getInstance()->getAllStudents();

?>